<template>
  <div class="card-wrap flex-column justify-end card-padding">
    <el-form :model="form" ref="selfCollecting" label-width="140px">
      <div class="card-title-wrap">
        <span>自行收车信息</span>
        <span></span>
      </div>
      <!--自行收车信息详情模块 -->
      <table-page v-if="type =='detail'" border :isSelect="false" :dataList="form.selfCollectingList" :total="total">
        <!-- 操作插槽 -->
        <template slot="tableColAc">
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button type="text" @click="view(scope.row)">查看</el-button>
            </template>
          </el-table-column>
        </template>
        <!-- 普通列插槽 -->
        <template slot="tableCol">
          <el-table-column label="收车人" align="center" prop="supplierName" min-width="140px" show-overflow-tooltip />
          <el-table-column label="交付人" align="center" prop="deliveryPeople" min-width="140px" show-overflow-tooltip />
          <el-table-column label="交付时间" align="center" prop="deliveryTime" min-width="140px" show-overflow-tooltip />
          <el-table-column label="收车数" align="center" prop="numberOfVehicles" min-width="120px" show-overflow-tooltip />
          <el-table-column label="提交人" align="center" prop="createBy" min-width="120px" show-overflow-tooltip />
          <el-table-column label="提交时间" align="center" prop="createTime" min-width="120px" show-overflow-tooltip />
        </template>
      </table-page>
    </el-form>
  </div>
</template>

<script>
import SearchContent from "@/components/SearchContent/index.vue";
export default {
  // 自行收车
  name: 'selfCollecting',
  components: {
    SearchContent
  },
  props: {
    value: {
      type: Object,
      default: {},
    },
    state: {
      type: String,
      default: '',
    },
  },
  computed: {
    form: {
      get() {
        return this.value;
      },
      set(val) {
        this.$emit("input", val);
      },
    },
    type() {
      let status
      switch (this.state) {
        case 'write':
          status = 'edit'
          break
        case 'disabled':
          status = 'detail'
          break
        case 'readonly':
          status = 'detail'
          break
        case 'detail':
          status = 'detail'
          break
        case 'edit':
          status = 'edit'
        case 'add':
          status = 'add'
          break
      }
      return status
    },
  },
  data() {
    return {
      total: 0,
    };
  },
  created() {
  },
  methods: {
    // 按钮
    view(row) {
      this._toPage({
        path: "/pickUpTheCar/selfCollectingDetail",
        name: "SelfCollectingDetail",
        query: {
          type: 'detail',
          id: row.id
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
</style>
